package Menu;


import login.User;
import manage.Admin;
import manage.userSys;

import java.util.Scanner;

public class adminMenu{

    private String uid;
    private String oid;

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public void showAdminMenu(){

        Admin admin=new Admin();
        //从登录中获取用户
        admin.getUsers();

        Scanner sc=new Scanner(System.in);

        while(true)
        {
            System.out.println("=================================");
            System.out.println("1.显示所有用户");
            System.out.println("2.显示所有商家");
            System.out.println("3.显示所有订单");
            System.out.println("4.查看所有菜品");
            System.out.println("5.根据订单id修改订单状态");
            System.out.println("6.根据id查找对应的用户");
            System.out.println("7.查看指定类别的菜品信息");
            System.out.println("8.删除指定id的菜品");
            System.out.println("9.删除指定的用户信息");
            System.out.println("10.修改密码");
            System.out.println("0.退出登录");
            System.out.println("=================================");

            int f=0;
            int od = sc.nextInt();
            switch (od) {
                case 0: {
                    System.out.println("您已退出登录！");
                    f=1;
                    break;
                }
                case 1:{
                    admin.showUsers();
                    break;
                }
                case 2:{
                    admin.findSlr();
                    break;
                }
                case 3:{
                    admin.showOrder();
                    break;
                }
                case 4:{
                    admin.showOrder();
                    break;
                }
                case 5:{
                    admin.changeOrderStatus();
                    break;
                }
                case 6:{
                    //输出找到的用户信息
                    System.out.println(admin.findByID(uid));
                    break;
                }
                case 7:{
                    admin.showDishesByType();
                    break;
                }
                case 8:{
                    admin.deleteDish();
                    break;
                }
                case 9:{
                    admin.delete(uid);
                    break;
                }
                case 10: {
                    admin.changePassword(uid);
                    break;
                }
                default:break;
            }
            if(f>0){
                break;//退出该界面
            }
        }


    }
}
